model_attrit_logit <- 
  glm(all_players_finish == T ~ player.age + factor(player.education == 4) + factor(player.gender == 1) +
        factor(player.religion == 1) + factor(player.ethnicity == 1),
      family = binomial(link = "logit"),
      data = supp_df)  

model_attrit_ols <- 
  lm(all_players_finish == T ~ player.age + factor(player.education == 4) + factor(player.gender == 1) +
       factor(player.religion == 1) + factor(player.ethnicity == 1),
     data = supp_df)  


table <- list(model_attrit_logit, model_attrit_ols)

note_text <- paste("Beta coefficients from Logit and OLS regressions.")

table = stargazer(table, type = 'latex', 
                  title = "Predictors of Attrition",
                  label = 'tab:attrition',
                  model.names = F,
                  model.numbers = T,
                  digits = 3,
                  column.separate = c(1,1),
                  column.labels = c("Logit", "OLS"),
                  dep.var.labels = "Dep. Var. = Attrit", 
                  
                  
                  covariate.labels = c("Age", "Education: College", "Gender: Male", "Religion: Muslim", "Ethnicity: Javanese"),
                  
                  #star.cutoffs = c(0.05, 0.01),
                  #float.env = 'sidewaystable',
                  keep.stat = c("n"),
                  notes = NULL,
                  notes.align = 'l')

write_latex(table[-c(10, 11, 18, 21, 24, 27, 30, 33, 38)], note_text, './outputs/tables/table_a9.tex', .8)
